package com.ehuoyun.ecstore.action;

import java.util.List;

import net.sourceforge.stripes.action.DefaultHandler;
import net.sourceforge.stripes.action.DontValidate;
import net.sourceforge.stripes.action.RedirectResolution;
import net.sourceforge.stripes.action.Resolution;
import net.sourceforge.stripes.integration.spring.SpringBean;

import com.ehuoyun.ecstore.biz.AdvertisementMgr;
import com.ehuoyun.ecstore.model.Advertisement;

//@UrlBinding("/index.jsp")
public class AdvertisementListActionBean extends AbstractActionBean {
	
	private List<Advertisement> ads;
	
    @SpringBean
    private AdvertisementMgr adMgr;
    
    public List<Advertisement> getAllAdvertisements() {
    	return ads;
    }

	@DefaultHandler
    public Resolution adList() {
        ads = adMgr.getAllAdvertisements(this.getContext().getUser());
        return new RedirectResolution("/index.jsp");
    }

    @DontValidate
    public Resolution edit() {
        return new RedirectResolution("/edit-ad.jsp");
    }

}
